package com.chatserver.client.gui;

import info.clearthought.layout.TableLayout;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

import com.chatserver.client.handlers.ConnectionHandler;

import java.awt.BorderLayout;
import java.awt.GridBagLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.Insets;

public class LoginScreen {
	private static final long serialVersionUID = 1L;
	private JPanel jPanel1;
	private JTextField username;
	private JLabel passdesc;
	private JPasswordField password;
	private JButton cancel;
	private JButton login;
	private JLabel userdesc;

	/**
	 * 
	 */

	public LoginScreen() {
		new JPanel();
	}

	/**
	 * This method initializes panel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	public JPanel getPanel() {
		jPanel1 = new JPanel();
		TableLayout jPanel1Layout1 = new TableLayout(new double[][] {{76.0, TableLayout.FILL, 130.0, TableLayout.FILL}, {69.0, 30.0, 30.0, 30.0}});
		jPanel1Layout1.setHGap(5);
		jPanel1Layout1.setVGap(5);
		TableLayout jPanel1Layout = new TableLayout(new double[][] {{100.0, 100.0, 28.0, TableLayout.FILL}, {30.0, 30.0, 30.0, TableLayout.FILL}});
		jPanel1Layout.setHGap(5);
		jPanel1Layout.setVGap(5);
		jPanel1.setLayout(jPanel1Layout1);
		getContentPane().add(jPanel1, BorderLayout.CENTER);
		{
			userdesc = new JLabel();
			jPanel1.add(userdesc, "1, 1");
			userdesc.setText("Username: ");
		}
		{
			username = new JTextField();
			jPanel1.add(username, "2, 1");
			username.setPreferredSize(new java.awt.Dimension(83, 22));
		}
		{
			passdesc = new JLabel();
			jPanel1.add(passdesc, "1, 2");
			passdesc.setText("Password:");
		}
		{
			login = new JButton();
			jPanel1.add(login, "1, 3");
			login.setText("Login");
		}
		{
			cancel = new JButton();
			jPanel1.add(cancel, "2, 3");
			cancel.setText("Cancel");
		}
		{
			password = new JPasswordField();
			jPanel1.add(password, "2, 2");
		}
	}

	/**
	 * This method initializes username	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getUsername() {
		if (username == null) {
			username = new JTextField(20);
		}
		return username;
	}

	/**
	 * This method initializes password	
	 * 	
	 * @return javax.swing.JPasswordField	
	 */
	private JPasswordField getPassword() {
		if (password == null) {
			password = new JPasswordField();
		}
		return password;
	}

	/**
	 * This method initializes login	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getLogin() {
		if (login == null) {
			login = new JButton("Login");
		}
		return login;
	}

	/**
	 * This method initializes cancel	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getCancel() {
		if (cancel == null) {
			cancel = new JButton("Cancel");
		}
		return cancel;
	}
}
